1.import java.util.Scanner;

public class sb {
    static double area;
    public static void main(String[] args) {
        int a,b;
        Scanner in=new Scanner(System.in);
        System.out.println("请输入长方形的长");
        a=in.nextInt();
        System.out.println("请输入长方形的宽");
        b= in.nextInt();
         a(a,b);
        System.out.println("长方形的面积="+area);
    }
    public static void a(int a,int b){
        area= a*b;

    }
}
2.import java.util.Scanner;

public class sb {
    static double area;
    public static void main(String[] args) {
        int a;
        Scanner in=new Scanner(System.in);
        System.out.println("请输入正方形的边长");
        a=in.nextInt();
         a(a);
        System.out.println("正方形的面积="+area);
    }
    public static void a(int a){
        area= a*a;

    }

}
3.import java.util.Scanner;

public class sb {
    static double area;
    public static void main(String[] args) {
        int a,b;
        Scanner in=new Scanner(System.in);
        System.out.println("请输入三角形的底");
        a=in.nextInt();
        System.out.println("请输入三角形的高");
        b= in.nextInt();
         a(a,b);
        System.out.println("三角形的面积="+area);
    }
    public static void a(int a,int b){
        area= a*b*0.5;

    }

}